﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using IBatisNet.DataMapper;

namespace BatisNetStudy.Demo
{
    class UserTest
    {
        public static void InserUser()
        {
            var mapper = Mapper.Instance();

            var user = new User
            {
                Id = Guid.NewGuid(),
                Name = "段光伟"
            };

            var result = mapper.Insert("InsertUser", user);
            Console.WriteLine(result);
        }

        public static void UpdateUser()
        {
            var mapper = Mapper.Instance();

            var users = mapper.QueryForList<User>("FindUsersByName", "段光伟");
            var user = users.First();
            user.Name = "段光宇";
            Console.WriteLine(String.Join("-", user.Version));
            mapper.Update("UpdateUser", user);
            Console.WriteLine(String.Join("-", user.Version));
        }
    }
}
